/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package almacen;

//import static almacen.EditProducto.code;
import de.centigrade.bizlaf.BizLafControl;
import de.centigrade.bizlaf.support.BizLafStyles;
import java.awt.Color;
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.sql.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Properties;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
import javax.swing.AbstractAction;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import javax.swing.table.TableModel;
import javax.swing.table.TableRowSorter;
import overrides.formatoTabla;
import resources.TableCellListener;
import resources.TableColumnManager;
import resources.jcProperties;
import resources.local_connection;
import resources.queries;

/**
 * @author Pascual, Homeroe
 */
public final class Almacen extends javax.swing.JFrame {
    public static final Logger logger = Logger.getLogger(Almacen.class.getName());
    public static boolean celulares = false;
    public static boolean precios = false;
    static jcProperties editarPropiedades = new jcProperties();
    static Properties propiedades = new Properties();
    public static int idUsuario = 0;// es el usuario nulo
    public static int suc1 = 0;
    public static int suc2 = 0;
    public static String nSuc1 = "", nSuc2 = "";
    public static String giro;
    static Connection cn;
    static PreparedStatement ps;
    static ResultSet rs, rs2;
    ResultSetMetaData rsm;
    DefaultTableModel dtm;
    TableColumnManager tcm;
    local_connection conexion;
    //propiedades propprod;
    formatoTabla ft; //para el jtable coloreado
    TableColumn ccolumna;
    private final TableColumnModel tcmo;

    public void setUsuario(int user) {
        idUsuario = user;
    }

    /**
     * Creates new form Almacen
     *
     * @throws java.sql.SQLException
     * @throws java.lang.ClassNotFoundException
     */
    public Almacen() throws SQLException, ClassNotFoundException {
        initComponents();
        cargarLog();
        BizLafControl.get().setStyle(jTextField1, BizLafStyles.SEARCH);
        conexion = new local_connection();
        cn = local_connection.getconnect();
        jTable1.setSelectionForeground(Color.white);
        jTable1.setSelectionBackground(Color.blue);//usar F2 para editar
        jTable1.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
        jTable1.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseReleased(MouseEvent e) {
                int r = jTable1.rowAtPoint(e.getPoint());
                int c = jTable1.columnAtPoint(e.getPoint());
                if (r >= 0 && r < jTable1.getRowCount()) {
                    if(jTable1.getSelectedRowCount()<=1)
                    jTable1.setRowSelectionInterval(r, r);
                    //else jTable1.setro
                    if (c >= 0) {
                        jTable1.setColumnSelectionInterval(c, c);
                    }
                } else {
                    jTable1.clearSelection();
                }

                int rowindex = jTable1.getSelectedRow();
                if (rowindex < 0) {
                    return;
                }
                if (e.isPopupTrigger() && e.getComponent() instanceof JTable) {
                    JPopupMenu popup = jPopupMenu2;
                    popup.show(e.getComponent(), e.getX(), e.getY());
                }
            }
        });
        tcm = new TableColumnManager(jTable1);
        propiedades = editarPropiedades.getProperties();
        suc1 = Integer.parseInt(propiedades.getProperty("sucursal1"));
        suc2 = Integer.parseInt(propiedades.getProperty("sucursal2"));
        giro = propiedades.getProperty("giro");
        if (giro.equals("Celulares")) {
            celulares = true;
        }
        if (propiedades.getProperty("precios").equals("Si")) {
            precios = true;
        }
        if (!precios) {
            jMenuItem2.setVisible(false);
        }
        agregarimei.setVisible(celulares);
        tcmo = jTable1.getColumnModel();
        // Checamos si es la misma sucursal y de ser asi, deshabilitamos ciertas opciones
        checkSameSucursal();
        this.action = new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent e) {
                TableCellListener tcl = (TableCellListener) e.getSource();
                String columna = "";
                int sucursal = suc1;
                int fila = tcl.getRow();
                boolean stock = false;
                String nombrec = dtm.getColumnName(tcl.getColumn());
                String tipo = String.valueOf(dtm.getValueAt(fila, 3));
                //adminSystem.out.println(tipo);
                /*switch (tcl.getColumn()) {
                case 1:
                columna = "nombre";
                break;
                case 2:
                columna = "descripcion";
                break;
                case 5:
                columna = "ubicacion";
                sucursal = suc1;
                stock = true;
                break;
                case 6:
                columna = "cantidad";
                sucursal = suc1;
                stock = true;
                break;
                case 7:
                columna = "ubicacion";
                sucursal = suc2;
                stock = true;
                break;
                case 8:
                columna = "cantidad";
                sucursal = suc2;
                stock = true;
                break;
                }*/
                switch (nombrec) {
                    case "Nombre":
                        columna = "nombre";
                        break;
                    case "Descripcion":
                        columna = "descripcion";
                        break;
                    case "Marca":
                        columna = "marca";
                        break;
                    case "Ubicacion(Suc1)":
                        columna = "ubicacion";
                        sucursal = suc1;
                        stock = true;
                        break;
                    case "Ubicacion(Suc2)":
                        columna = "ubicacion";
                        sucursal = suc2;
                        stock = true;
                        break;
                    case "Cantidad(Suc1)":
                        columna = "cantidad";
                        sucursal = suc1;
                        stock = true;
                        break;
                    case "Cantidad(Suc2)":
                        columna = "cantidad";
                        sucursal = suc2;
                        stock = true;
                        break;
                }
                if (!stock) {
                    queries.doSyncQuery(cn, ps, "UPDATE productos SET " + columna + " = '" + String.valueOf(tcl.getNewValue()) + "' WHERE id_producto = " + dtm.getValueAt(fila, 0));
                    System.out.println("UPDATE productos SET " + columna + " = '" + String.valueOf(tcl.getNewValue()) + "' WHERE id_producto = " + dtm.getValueAt(fila, 0));
                } else {
                    if (!tipo.equals("Celular") && !tipo.equals("Chip")) {
                        try {
                            ps = cn.prepareStatement("select 1 from stock where id_producto = ? and sucursal = ?");
                            ps.setInt(1, (int) dtm.getValueAt(fila, 0));
                            ps.setInt(2, sucursal);
                            rs = ps.executeQuery();
                            // System.out.println(ps.toString());
                            if (!rs.next()) {
                                queries.doSyncQuery(cn, ps, "insert into stock  (" + columna + ", id_producto, sucursal) values(" + ((columna.equals("ubicacion")) ? "'" : "") + String.valueOf(tcl.getNewValue()) + ((columna.equals("ubicacion")) ? "'" : "") + ", " + dtm.getValueAt(fila, 0) + ", " + sucursal + ")");
                            } else {
                                queries.doSyncQuery(cn, ps, "UPDATE stock SET " + columna + " = " + ((columna.equals("ubicacion")) ? "'" : "") + String.valueOf(tcl.getNewValue()) + ((columna.equals("ubicacion")) ? "'" : "") + " WHERE id_producto = " + dtm.getValueAt(fila, 0) + " AND sucursal =" + sucursal);

                            }
                            ps = cn.prepareStatement("insert into es_almacen(concepto,sucursal,antes,despues,id_producto,id_usuario) values('Ajuste',?,?,?,?,?)");
                            ps.setInt(1, sucursal);
                            ps.setFloat(2, (float) (int) tcl.getOldValue());
                            ps.setFloat(3, (float) (int) tcl.getNewValue());
                            ps.setInt(4, (int) dtm.getValueAt(fila, 0));
                            ps.setInt(5, idUsuario);
                            ps.execute();
                        } catch (SQLException ex) {
                            Almacen.logger.log(Level.SEVERE, null, ex);
                        }
                    }
                    // System.out.println("UPDATE stock SET " + columna + " = " + String.valueOf(tcl.getNewValue()) + " WHERE id_producto = "+ dtm.getValueAt(fila, 0) +" AND sucursal ="+sucursal);
                }
                if (columna.equals("cantidad")) {
                    insertarRevision(fila);
                }
            }
        };
        dtm = (DefaultTableModel) this.jTable1.getModel();
        ft = new formatoTabla(6, dtm, jTable1);
        for (int columnIndex = 0; columnIndex < jTable1.getColumnCount(); columnIndex++) {
            jTable1.getColumnModel().getColumn(columnIndex).setCellRenderer(ft);
        }
        TableRowSorter<TableModel> elQueOrdena = new TableRowSorter<TableModel>(dtm);
        jTable1.setRowSorter(elQueOrdena);
        activo.setSelected(true);
        int[] anchos = {40, 80, 200, 50, 50, 50, 50, 40, 50, 40, 50};
        jComboBox2.removeAllItems();
        jComboBox2.addItem("Por NOMBRE y DESCRIPCION, CODIGO");
        jComboBox2.addItem("Por CODIGO UBICACION");

        for (int i = 0; i < jTable1.getColumnCount(); i++) {
            jTable1.getColumnModel().getColumn(i).setPreferredWidth(anchos[i]);
        }

        TableCellListener tcl = new TableCellListener(jTable1, action);
        consultarProductos();
        //ocultamos las columnas que no nos gustan
        if (Integer.parseInt(propiedades.getProperty("Cantidad(Suc1)")) == 0) {
            tcm.hideColumn("Cantidad(Suc1)");
        }
        if (Integer.parseInt(propiedades.getProperty("Marca")) == 0) {
            tcm.hideColumn("Marca");
        }
        if (Integer.parseInt(propiedades.getProperty("Nombre")) == 0) {
            tcm.hideColumn("Nombre");
        }
        if (Integer.parseInt(propiedades.getProperty("Fecha-Act")) == 0) {
            tcm.hideColumn("Fecha-Act");
        }
        if (Integer.parseInt(propiedades.getProperty("Codigo")) == 0) {
            tcm.hideColumn("Codigo");
        }
        if (Integer.parseInt(propiedades.getProperty("Descripcion")) == 0) {
            tcm.hideColumn("Descripcion");
        }
        if (Integer.parseInt(propiedades.getProperty("Ubicacion(Suc2)")) == 0) {
            tcm.hideColumn("Ubicacion(Suc2))");
        }
        if (Integer.parseInt(propiedades.getProperty("Ubicacion(Suc1)")) == 0) {
            tcm.hideColumn("Ubicacion(Suc1)");
        }
        if (Integer.parseInt(propiedades.getProperty("Proveedor")) == 0) {
            tcm.hideColumn("Proveedor");
        }
        if (Integer.parseInt(propiedades.getProperty("Cantidad(Suc2)")) == 0) {
            tcm.hideColumn("Cantidad(Suc2)");
        }
    }
    AbstractAction action;

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPopupMenu2 = new javax.swing.JPopupMenu();
        editProducto = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        Categorizar = new javax.swing.JMenuItem();
        transferirMenu = new javax.swing.JMenuItem();
        stockmenu = new javax.swing.JMenuItem();
        nuevoLote = new javax.swing.JMenuItem();
        agregarimei = new javax.swing.JMenuItem();
        Retiro = new javax.swing.JMenuItem();
        jComboBox2 = new javax.swing.JComboBox();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jTextField1 = new javax.swing.JTextField();
        activo = new javax.swing.JCheckBox();
        inventariadoCheck = new javax.swing.JCheckBox();
        jButton1 = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        lblSuc1 = new javax.swing.JLabel();
        lblSuc2 = new javax.swing.JLabel();
        menuBar = new javax.swing.JMenuBar();
        menuconfiguracion = new javax.swing.JMenu();
        openMenuItem = new javax.swing.JMenuItem();
        cambiarSucMenuItem = new javax.swing.JMenuItem();
        menuProveedores = new javax.swing.JMenuItem();
        menuImagenFactura = new javax.swing.JMenuItem();
        exitMenuItem = new javax.swing.JMenuItem();
        menuproductos = new javax.swing.JMenu();
        jMenuItem5 = new javax.swing.JMenuItem();
        menuCategorias = new javax.swing.JMenuItem();
        jMenuItem6 = new javax.swing.JMenuItem();
        jMenuSyncTienda = new javax.swing.JMenuItem();
        copiarPrecios = new javax.swing.JMenuItem();
        menureportes = new javax.swing.JMenu();
        menufacturas = new javax.swing.JMenuItem();
        reingresoo = new javax.swing.JMenuItem();
        esalmacen = new javax.swing.JMenuItem();

        editProducto.setText("Propiedades");
        editProducto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                editProductoActionPerformed(evt);
            }
        });
        jPopupMenu2.add(editProducto);

        jMenuItem2.setText("Precios");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jPopupMenu2.add(jMenuItem2);

        Categorizar.setText("Categorizar");
        Categorizar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CategorizarActionPerformed(evt);
            }
        });
        jPopupMenu2.add(Categorizar);

        transferirMenu.setText("Transferir");
        transferirMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                transferirMenuActionPerformed(evt);
            }
        });
        jPopupMenu2.add(transferirMenu);

        stockmenu.setText("Stock");
        stockmenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                stockmenuActionPerformed(evt);
            }
        });
        jPopupMenu2.add(stockmenu);

        nuevoLote.setText("Nuevo Lote");
        nuevoLote.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                nuevoLoteActionPerformed(evt);
            }
        });
        jPopupMenu2.add(nuevoLote);

        agregarimei.setText("Agregar");
        agregarimei.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                agregarimeiActionPerformed(evt);
            }
        });
        jPopupMenu2.add(agregarimei);

        Retiro.setText("Retiro de Material");
        Retiro.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RetiroActionPerformed(evt);
            }
        });
        jPopupMenu2.add(Retiro);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("TeslaBEM Almacen");
        setIconImage(new ImageIcon(getClass().getResource("/resources/logo_rayito.png")).getImage());

        jComboBox2.addPopupMenuListener(new javax.swing.event.PopupMenuListener() {
            public void popupMenuCanceled(javax.swing.event.PopupMenuEvent evt) {
            }
            public void popupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent evt) {
                jComboBox2PopupMenuWillBecomeInvisible(evt);
            }
            public void popupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) {
            }
        });
        jComboBox2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBox2ActionPerformed(evt);
            }
        });

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Codigo", "Nombre", "Descripcion", "Tipo", "Marca", "Proveedor", "Ubicacion(Suc1)", "Cantidad(Suc1)", "Ubicacion(Suc2)", "Cantidad(Suc2)", "Fecha-Act"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Integer.class, java.lang.String.class, java.lang.Integer.class, java.lang.Object.class
            };
            boolean[] canEdit = new boolean [] {
                false, true, true, false, true, false, true, true, true, true, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jTable1.setToolTipText("");
        jTable1.setColumnSelectionAllowed(true);
        jTable1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jTable1.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTable1KeyPressed(evt);
            }
        });
        jScrollPane1.setViewportView(jTable1);
        jTable1.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        if (jTable1.getColumnModel().getColumnCount() > 0) {
            jTable1.getColumnModel().getColumn(1).setMaxWidth(250);
            jTable1.getColumnModel().getColumn(10).setMinWidth(70);
            jTable1.getColumnModel().getColumn(10).setPreferredWidth(70);
            jTable1.getColumnModel().getColumn(10).setMaxWidth(120);
        }

        jTextField1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextField1ActionPerformed(evt);
            }
        });
        jTextField1.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTextField1KeyReleased(evt);
            }
        });

        activo.setText("Activo");
        activo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                activoActionPerformed(evt);
            }
        });

        inventariadoCheck.setText("Inventariado");
        inventariadoCheck.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                inventariadoCheckActionPerformed(evt);
            }
        });

        jButton1.setText("Buscar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jLabel1.setText("Sucursal1:");

        jLabel2.setText("Sucursal2:");

        lblSuc1.setText("jLabel3");

        lblSuc2.setText("jLabel3");

        menuconfiguracion.setMnemonic('f');
        menuconfiguracion.setText("Configuracion");

        openMenuItem.setMnemonic('o');
        openMenuItem.setText("Cambiar conexion");
        openMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                openMenuItemActionPerformed(evt);
            }
        });
        menuconfiguracion.add(openMenuItem);

        cambiarSucMenuItem.setText("Cambiar sucursal");
        cambiarSucMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cambiarSucMenuItemActionPerformed(evt);
            }
        });
        menuconfiguracion.add(cambiarSucMenuItem);

        menuProveedores.setText("Proveedores");
        menuProveedores.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuProveedoresActionPerformed(evt);
            }
        });
        menuconfiguracion.add(menuProveedores);

        menuImagenFactura.setText("Imagenes de Factura");
        menuImagenFactura.setEnabled(false);
        menuImagenFactura.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuImagenFacturaActionPerformed(evt);
            }
        });
        menuconfiguracion.add(menuImagenFactura);

        exitMenuItem.setMnemonic('x');
        exitMenuItem.setText("Salir");
        exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitMenuItemActionPerformed(evt);
            }
        });
        menuconfiguracion.add(exitMenuItem);

        menuBar.add(menuconfiguracion);

        menuproductos.setText("Productos");

        jMenuItem5.setText("Agregar Nuevo");
        jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem5ActionPerformed(evt);
            }
        });
        menuproductos.add(jMenuItem5);

        menuCategorias.setText("Categorias");
        menuCategorias.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuCategoriasActionPerformed(evt);
            }
        });
        menuproductos.add(menuCategorias);

        jMenuItem6.setText("Productos bajos en stock");
        jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem6ActionPerformed(evt);
            }
        });
        menuproductos.add(jMenuItem6);

        jMenuSyncTienda.setText("Syncronizar stock con tienda web");
        jMenuSyncTienda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuSyncTiendaActionPerformed(evt);
            }
        });
        menuproductos.add(jMenuSyncTienda);

        copiarPrecios.setText("Copiar Precios");
        copiarPrecios.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                copiarPreciosActionPerformed(evt);
            }
        });
        menuproductos.add(copiarPrecios);

        menuBar.add(menuproductos);

        menureportes.setText("Reportes");

        menufacturas.setText("Facturas");
        menufacturas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menufacturasActionPerformed(evt);
            }
        });
        menureportes.add(menufacturas);

        reingresoo.setText("Reingreso de Material");
        reingresoo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                reingresooActionPerformed(evt);
            }
        });
        menureportes.add(reingresoo);

        esalmacen.setText("Entradas y Salidas");
        esalmacen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                esalmacenActionPerformed(evt);
            }
        });
        menureportes.add(esalmacen);

        menuBar.add(menureportes);

        setJMenuBar(menuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lblSuc1)
                        .addGap(155, 155, 155)
                        .addComponent(jLabel2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(lblSuc2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(inventariadoCheck))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 713, Short.MAX_VALUE)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jTextField1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jButton1)
                                .addGap(10, 10, 10)
                                .addComponent(activo)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap())))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(activo)
                    .addComponent(jButton1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 359, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(inventariadoCheck)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel1)
                        .addComponent(jLabel2)
                        .addComponent(lblSuc1)
                        .addComponent(lblSuc2))))
        );

        getAccessibleContext().setAccessibleDescription("");

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jComboBox2PopupMenuWillBecomeInvisible(javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_jComboBox2PopupMenuWillBecomeInvisible
        consultarProductos();
    }//GEN-LAST:event_jComboBox2PopupMenuWillBecomeInvisible
private void cargarLog() {//este metodo inicializa el log de errores
        try {

            FileHandler fh;
            fh = new FileHandler("errores.txt", true);
            logger.addHandler(fh);
            SimpleFormatter formatter = new SimpleFormatter();
            fh.setFormatter(formatter);
        } catch (IOException | SecurityException ex) {
            logger.log(Level.SEVERE, null, ex);

        }
    }
    public void consultarProductos() {
        dtm.setRowCount(0);
        String select;
        String consulta, activado = "";
        String como, where1 = null, where2 = null, where3 = null;

        switch (jComboBox2.getSelectedIndex()) {
            case 1:
                where1 = "c.ubicacion LIKE '%";
                where2 = "%' OR c.ubicacion LIKE '%";
                where3 = "%' OR d.ubicacion LIKE '%";
                break;
            default:
                where1 = "a.nombre LIKE '%";
                where2 = "%' OR a.descripcion LIKE '%";
                where3 = "%' OR a.id_producto LIKE '%";
                break;
        }
        if (activo.isSelected()) {
            activado = " AND a.activo = 1";
        }
        try {
            select = "SELECT a.id_producto, a.nombre, a.descripcion,a.tipo,a.marca,concat(e.nombre,' ',e.paterno,' ',e.materno), c.ubicacion, if(c.cantidad is null, 0,c.cantidad), d.ubicacion, if(d.cantidad is null, 0,d.cantidad), b.fecha FROM productos a LEFT OUTER JOIN stock c ON (a.id_producto = c.id_producto AND c.sucursal = " + suc1 + ") LEFT OUTER JOIN stock d ON (a.id_producto = d.id_producto AND d.sucursal = " + suc2 + ") LEFT OUTER JOIN revisiones b ON (a.id_producto = b.idProducto)LEFT OUTER JOIN personas e ON (a.id_proveedor = e.id_persona) WHERE (";
            como = jTextField1.getText();
            consulta = select + where1 + como + where2 + como + where3 + como + "%')" + activado;
            ps = (PreparedStatement) cn.prepareStatement(consulta);
            rs = ps.executeQuery();
            ArrayList<Object[]> data = new ArrayList<>();

            while (rs.next()) {
                Object[] rows = new Object[dtm.getColumnCount()];
                for (int i = 0; i < rows.length; i++) {
                    if ((i == 7) || (i == 9)) {
                        rows[i] = rs.getInt(i + 1);
                    } else {
                        rows[i] = rs.getObject(i + 1);
                    }
                }
                data.add(rows);
            }

            for (Object[] data1 : data) {
                dtm.addRow(data1);
            }

        } catch (SQLException e) {
            logger.log(Level.SEVERE, null, e);
        }
    }

    @SuppressWarnings("empty-statement")
    private void jTextField1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField1KeyReleased
        if (evt.getKeyCode() == 10) {
            consultarProductos();
        };
    }//GEN-LAST:event_jTextField1KeyReleased

    private void editProductoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editProductoActionPerformed
        int row = jTable1.getSelectedRow();
        if (row != -1) {
            row = jTable1.convertRowIndexToModel(row);
            EditProducto propprod = new EditProducto(Integer.parseInt(String.valueOf(dtm.getValueAt(row, 0))));
            propprod.setLocationRelativeTo(null);
            propprod.setVisible(true);

        }
        /* jTable1.changeSelection(row, 0, false, false);
         jTable1.changeSelection(row, 1, false, false);
         jTable1.changeSelection(row, 2, false, false);*/
    }//GEN-LAST:event_editProductoActionPerformed

    private void jComboBox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jComboBox2ActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        int row = jTable1.getSelectedRow();
        int column = jTable1.getSelectedColumn();
        ccolumna = tcmo.getColumn(column);
        if (row != -1) {
            row = jTable1.convertRowIndexToModel(row);
            int sucursal = (!ccolumna.getHeaderValue().toString().contains("2")) ? suc1 : suc2;
            precios_new precio = new precios_new(Integer.parseInt(String.valueOf(dtm.getValueAt(row, 0))), sucursal);
            precio.setLocationRelativeTo(null);
            precio.setVisible(true);
        }
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    private void transferirMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_transferirMenuActionPerformed
        int row = jTable1.getSelectedRow();
        if (row != -1) {
            row = jTable1.convertRowIndexToModel(row);
            int codigo = Integer.parseInt(String.valueOf(dtm.getValueAt(row, 0)));
            String tipo = String.valueOf(dtm.getValueAt(row, 3));
            if ((tipo.equals("Chip") || tipo.equals("Celular")) && suc1 != suc2) {
                transferirEspeciales transfiere = new transferirEspeciales(tipo, codigo, suc1, suc2);
                transfiere.setLocationRelativeTo(null);
                transfiere.setVisible(true);
            } else {

                Transferir transfiere = new Transferir(this, true, codigo);
                transfiere.setLocationRelativeTo(null);
                transfiere.setVisible(true);

            }

        }
        consultarProductos();
        // TODO add your handling code here:
    }//GEN-LAST:event_transferirMenuActionPerformed

    private void stockmenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stockmenuActionPerformed
        int row = jTable1.getSelectedRow();
        if (row != -1) {
            row = jTable1.convertRowIndexToModel(row);
            //String tipo = String.valueOf(dtm.getValueAt(row, 3));
          //  if (tipo.equals("Producto")) {
                stock stock = new stock(this,true,Integer.parseInt(String.valueOf(dtm.getValueAt(row, 0))));
                stock.setLocationRelativeTo(null);
                stock.setVisible(true);
            //}
        }
      /*  consultarProductos();
        jTable1.changeSelection(row, 0, false, false);
        jTable1.changeSelection(row, 1, false, false);
        jTable1.changeSelection(row, 2, false, false);*/
        // TODO add your handling code here:
    }//GEN-LAST:event_stockmenuActionPerformed

    private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed
        System.exit(0);
    }//GEN-LAST:event_exitMenuItemActionPerformed

    private void openMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openMenuItemActionPerformed
        cambiarConexion cambiarconexion = new cambiarConexion(this, true);
        cambiarconexion.setLocationRelativeTo(null);
        cambiarconexion.setVisible(true);
        try {
            cn = local_connection.getconnect();
        } catch (SQLException ex) {
            logger.log(Level.SEVERE, null, ex);
        }
        // TODO add your handling code here:
    }//GEN-LAST:event_openMenuItemActionPerformed

    private void nuevoLoteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nuevoLoteActionPerformed
        int row = jTable1.getSelectedRow();
        int column = jTable1.getSelectedColumn();
        ccolumna = tcmo.getColumn(column);
        if (row != -1) {
            row = jTable1.convertRowIndexToModel(row);
            int sucursal = (!ccolumna.getHeaderValue().toString().contains("2")) ? suc1 : suc2;
            lotes lote = new lotes(this, true, Integer.parseInt(String.valueOf(dtm.getValueAt(row, 0))), sucursal);
            lote.setLocationRelativeTo(null);
            lote.setVisible(true);
        }
        consultarProductos();
        jTable1.changeSelection(row, 0, false, false);
        jTable1.changeSelection(row, 1, false, false);
        jTable1.changeSelection(row, 2, false, false);
    }//GEN-LAST:event_nuevoLoteActionPerformed

    private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed
        NuevoProducto nuevo = new NuevoProducto();
        nuevo.setLocationRelativeTo(null);
        nuevo.setVisible(true);
    }//GEN-LAST:event_jMenuItem5ActionPerformed

    private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed
        Escasos bajos = new Escasos(this, true);
        bajos.setLocationRelativeTo(null);
        bajos.setVisible(true);
    }//GEN-LAST:event_jMenuItem6ActionPerformed

    private void activoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_activoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_activoActionPerformed

    @SuppressWarnings("empty-statement")
    private void jTable1KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTable1KeyPressed
        if (evt.getKeyCode() == KeyEvent.VK_F12) {
            int row = jTable1.getSelectedRow();
            if (row != -1) {
                row = jTable1.convertRowIndexToModel(row);
                insertarRevision(row);
            }
        }
    }//GEN-LAST:event_jTable1KeyPressed

    private void inventariadoCheckActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_inventariadoCheckActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_inventariadoCheckActionPerformed

    public static void openWebpage(URI uri) {
        Desktop desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
        if (desktop != null && desktop.isSupported(Desktop.Action.BROWSE)) {
            try {
                desktop.browse(uri);
            } catch (IOException e) {
                logger.log(Level.SEVERE, null, e);
            }
        }
    }

    public static void openWebpage(URL url) {
        try {
            openWebpage(url.toURI());
        } catch (URISyntaxException e) {
            Almacen.logger.log(Level.SEVERE, null, e);
        }
    }

    private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jTextField1ActionPerformed

    private void cambiarSucMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cambiarSucMenuItemActionPerformed
        cambiarSucursal sucu = new cambiarSucursal();
        sucu.setLocationRelativeTo(null);
        sucu.setVisible(true);
    }//GEN-LAST:event_cambiarSucMenuItemActionPerformed

    private void jMenuSyncTiendaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuSyncTiendaActionPerformed
        SyncTienda sync = new SyncTienda();
        sync.setLocationRelativeTo(null);
        sync.setVisible(true);
    }//GEN-LAST:event_jMenuSyncTiendaActionPerformed

    private void menuCategoriasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuCategoriasActionPerformed
        agregarCategorias cat = new agregarCategorias();
        cat.setLocationRelativeTo(null);
        cat.setVisible(true);
    }//GEN-LAST:event_menuCategoriasActionPerformed

    private void menuImagenFacturaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuImagenFacturaActionPerformed
        try {
            imagenFacturas fac = new imagenFacturas();
            fac.setLocationRelativeTo(null);
            fac.setVisible(true);
        } catch (IOException ex) {
            logger.log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_menuImagenFacturaActionPerformed

    private void menuProveedoresActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuProveedoresActionPerformed
          verProveedores prov = new verProveedores();
         prov.setLocationRelativeTo(null);
         prov.setVisible(true);
    }//GEN-LAST:event_menuProveedoresActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        consultarProductos();
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton1ActionPerformed

    private void menufacturasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menufacturasActionPerformed
        (new Facturas()).setVisible(true);
    }//GEN-LAST:event_menufacturasActionPerformed

    private void agregarimeiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_agregarimeiActionPerformed
        int row = jTable1.getSelectedRow();
        String tipo = "";
        int column = jTable1.getSelectedColumn();
        ccolumna = tcmo.getColumn(column);
        if (row != -1) {
            row = jTable1.convertRowIndexToModel(row);
            tipo = String.valueOf(dtm.getValueAt(row, 3));
            if (!tipo.equals("Producto")) {
                int sucursal = (!ccolumna.getHeaderValue().toString().contains("2")) ? suc1 : suc2;
                Especiales esp = new Especiales(this, true, (int) (dtm.getValueAt(row, 0)), tipo, sucursal);
                esp.setLocationRelativeTo(null);
                esp.setVisible(true);
            }
        }
        // TODO add your handling code here:
    }//GEN-LAST:event_agregarimeiActionPerformed

    private void RetiroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_RetiroActionPerformed
        int row = jTable1.getSelectedRow();
        String nombre = "";
        int column = jTable1.getSelectedColumn();
        float cantidad;
        ccolumna = tcmo.getColumn(column);
        if (row != -1) {
            row = jTable1.convertRowIndexToModel(row);
            int sucursal = (ccolumna.getHeaderValue().toString().contains("2")) ? 2 : 1;
           // System.out.println(suc1+" "+suc2);
            Object celda = dtm.getValueAt(row, (sucursal == 1) ? 7 : 9);
            cantidad = (float) (int) ((celda == null) ? 0 : celda);
            nombre = String.valueOf(dtm.getValueAt(row, 1));
            if (cantidad > 0.0f) {
                String tipo = String.valueOf(dtm.getValueAt(row, 3));
                if ((tipo.equals("Chip") || tipo.equals("Celular")) ) {
                    //sucursal = (ccolumna.getHeaderValue().toString().contains("2")) ? suc1 : suc2;
                    RetiroEspecial retiro = new RetiroEspecial((int) (dtm.getValueAt(row, 0)),nombre, sucursal, cantidad);
                    retiro.setLocationRelativeTo(null);
                    retiro.setVisible(true);
                } else {
                    RetiroMaterial retiro = new RetiroMaterial((int) (dtm.getValueAt(row, 0)), nombre, sucursal, cantidad);
                    retiro.setLocationRelativeTo(null);
                    retiro.setVisible(true);
                }
            } else {
                JOptionPane.showMessageDialog(null, "No hay stock para retirar en esta sucursal", "Sin stock para retirar",
                        JOptionPane.ERROR_MESSAGE);
            }
        }
    }//GEN-LAST:event_RetiroActionPerformed

    private void copiarPreciosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_copiarPreciosActionPerformed
        (new copiarprecios()).setVisible(true);
        // TODO add your handling code here:
    }//GEN-LAST:event_copiarPreciosActionPerformed

    private void reingresooActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_reingresooActionPerformed
        (new Reingreso()).setVisible(true);
        // TODO add your handling code here:
    }//GEN-LAST:event_reingresooActionPerformed

    private void esalmacenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_esalmacenActionPerformed
        (new ReporteES()).setVisible(true);
        // TODO add your handling code here:
    }//GEN-LAST:event_esalmacenActionPerformed

    private void CategorizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CategorizarActionPerformed
        int n= jTable1.getSelectedRowCount();
        if(n>0){
            ArrayList<Integer> ids=new ArrayList(n);
            int row;
            for(int i=0;i<n;i++){
                row=jTable1.getSelectedRows()[i];
                row=jTable1.convertRowIndexToModel(row);
                ids.add((int)dtm.getValueAt(row, 0));
            }
            (new Categorias(this,true,ids)).setVisible(true);
        }
        
        // TODO add your handling code here:
    }//GEN-LAST:event_CategorizarActionPerformed

    public static void checkSameSucursal() {
        try {
            ps = cn.prepareStatement("Select nombre from sucursales where id = ? or id=? order by id asc");
            ps.setInt(1, suc1);
            ps.setInt(2, suc2);

             //  System.out.println(ps);
            rs = ps.executeQuery();
            rs.next();
            if (suc1 < suc2) {
                nSuc1 = rs.getString(1);
            } else if (suc1 == suc2) {
                nSuc1 = nSuc2 = rs.getString(1);
            } else {
                nSuc2 = rs.getString(1);
            }
            if (rs.next()) {
                //transferirMenu.setEnabled(true);
                if (suc1 < suc2) {
                    nSuc2 = rs.getString(1);
                } else {
                    nSuc1 = rs.getString(1);
                }
            } else {
                nSuc2 = nSuc1;
                //  transferirMenu.setEnabled(false);
            }
            lblSuc1.setText(nSuc1);
            lblSuc2.setText(nSuc2);

        } catch (SQLException ex) {
            logger.log(Level.SEVERE, null, ex);
        }

    }

    // Al modificar un stock en almacen o mostrador, se guarda un registro del movimiento. Esta funcion
    // Revisa si no existe un 
    private void insertarRevision(int fila) {
        if (inventariadoCheck.isSelected() == true) {
            try {
                int id = (int) dtm.getValueAt(fila, 0);
                DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
                Date date = (Date) dtm.getValueAt(fila, 10);
                int almacen = (int) dtm.getValueAt(fila, 9);
                int stock = (int) dtm.getValueAt(fila, 7);
                if (date != null) {
                    date = new Date();
                    queries.doSyncQuery(cn, ps, "UPDATE revisiones SET fecha = '" + dateFormat.format(date) + "' WHERE idProducto = " + id);
                    //  System.out.println("UPDATE revisiones SET fecha = '" + dateFormat.format(date) + "' WHERE idProducto = " + id);
                } else {
                    date = new Date();
                    queries.doSyncQuery(cn, ps, "INSERT INTO revisiones(idProducto,cantidad_1,cantidad_2,fecha,sucursal_1,sucursal_2) VALUES(" + id + "," + almacen + "," + stock + ",'" + dateFormat.format(date) + "'," + suc1 + "," + suc2 + ")");
                    // System.out.println("INSERT INTO revisiones(idProducto,cantidad_1,cantidad_2,fecha,sucursal_1,sucursal_2) VALUES(" + id + "," + almacen + "," + stock + ",'" + dateFormat.format(date) +"',"+suc1+","+suc2+")");
                }
                ps.execute();
                //   consultarProductos();
            } catch (SQLException ex) {
                logger.log(Level.SEVERE, null, ex);
            }
        }
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem Categorizar;
    private javax.swing.JMenuItem Retiro;
    private javax.swing.JCheckBox activo;
    private javax.swing.JMenuItem agregarimei;
    private javax.swing.JMenuItem cambiarSucMenuItem;
    private javax.swing.JMenuItem copiarPrecios;
    private javax.swing.JMenuItem editProducto;
    private javax.swing.JMenuItem esalmacen;
    private javax.swing.JMenuItem exitMenuItem;
    private javax.swing.JCheckBox inventariadoCheck;
    private javax.swing.JButton jButton1;
    private javax.swing.JComboBox jComboBox2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JMenuItem jMenuItem6;
    private javax.swing.JMenuItem jMenuSyncTienda;
    private javax.swing.JPopupMenu jPopupMenu2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTable1;
    private javax.swing.JTextField jTextField1;
    private static javax.swing.JLabel lblSuc1;
    private static javax.swing.JLabel lblSuc2;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JMenuItem menuCategorias;
    private javax.swing.JMenuItem menuImagenFactura;
    private javax.swing.JMenuItem menuProveedores;
    private javax.swing.JMenu menuconfiguracion;
    private javax.swing.JMenuItem menufacturas;
    private javax.swing.JMenu menuproductos;
    private javax.swing.JMenu menureportes;
    private javax.swing.JMenuItem nuevoLote;
    private javax.swing.JMenuItem openMenuItem;
    private javax.swing.JMenuItem reingresoo;
    private javax.swing.JMenuItem stockmenu;
    private static javax.swing.JMenuItem transferirMenu;
    // End of variables declaration//GEN-END:variables
}
